import request from '@/utils/request'
import { microservices } from '@/utils'

export function getSysCodeTypeTree () {
  return request({
    url: `${microservices.pmsSys}/SysCodeType/tree`,
    method: 'get'
  })
}

export function putSysCodeType (data) {
  return request({
    url: `${microservices.pmsSys}/SysCodeType`,
    data,
    method: 'put'
  })
}

export function deleteSysCodeType (id) {
  return request({
    url: `${microservices.pmsSys}/SysCodeType/${id}`,
    method: 'delete'
  })
}

export function getSysCode (params) {
  let sortStr = params.sortStr
  delete params.sortStr
  return request({
    url: `${microservices.pmsSys}/SysCode?${sortStr}`,
    params
  })
}

export function deleteSysCode (id) {
  return request({
    url: `${microservices.pmsSys}/SysCode/${id}`,
    method: 'delete'
  })
}

export function putSysCode (data) {
  return request({
    url: `${microservices.pmsSys}/SysCode`,
    data,
    method: 'put'
  })
}

export function postSysCodeType (data) {
  return request({
    url: `${microservices.pmsSys}/SysCodeType`,
    data,
    method: 'post'
  })
}

export function postSysCode (data) {
  return request({
    url: `${microservices.pmsSys}/SysCode`,
    data,
    method: 'post'
  })
}

export function getSysCodeByTypeCode (params) {
  return request({
    url: `${microservices.pmsSys}/SysCode/getSysCodeByTypeCode/${params}`,
    method: 'get'
  })
}
